import {Image, StyleSheet, View, Text, TouchableOpacity, Switch} from 'react-native';
import {Stack, useRouter} from "expo-router";
import { scaleSize } from "@/utils/screenSize"
import AntDesign from '@expo/vector-icons/AntDesign';
import { Ionicons } from '@expo/vector-icons';
import { useState } from "react";
import SwitchToggle from 'react-native-switch-toggle';

export default function noticeScreen() {

    const router = useRouter();
    const [isEnabled, setIsEnabled] = useState(false);

    const toggleSwitch = () => setIsEnabled(previousState => !previousState);


    return (
        <View style={{ height: "100%", backgroundColor: "#F7F7F7" }}>
            <Stack.Screen
                options={{
                    title: '通知设置', // 设置屏幕标题
                    headerStyle: {
                        backgroundColor: '#f7f7f7', // 设置标题栏的背景颜色
                    },
                    headerShadowVisible: false, // 隐藏底部阴影和边框
                    headerBackTitleVisible: false,
                    headerTintColor: "#333",
                    headerLeft: () => (
                        <TouchableOpacity onPress={() => router.back()}>
                            <AntDesign name="left" size={19} color="#333" />
                            {/*<Ionicons name="arrow-back" size={30} color="#fff" style={{ paddingLeft: 15 }} />*/}
                        </TouchableOpacity>
                    ),
                }}
            />
            <View style={styles.settingWrap}>
                <View style={styles.settingItem}>
                    <Text style={styles.settingText}>关注通知</Text>
                    <SwitchToggle
                        switchOn={isEnabled}
                        onPress={() => setIsEnabled(!isEnabled)}
                        circleColorOff='#FFF'
                        circleColorOn='#FFF'
                        backgroundColorOn='#EC6138'
                        backgroundColorOff='#E4E6EC'
                        containerStyle={{
                            width: 52, // 这里设置开关的宽度
                            height: 28, // 设置开关的高度
                            borderRadius: 20,
                            padding: 4,
                        }}
                        circleStyle={{
                            width: 22, // 设置开关按钮的宽度
                            height: 22, // 设置开关按钮的高度
                            borderRadius: 15,
                        }}
                    />
                </View>
                <View style={[styles.settingItem, styles.cleanBom]}>
                    <Text style={styles.settingText}>私信通知</Text>
                    <SwitchToggle
                        switchOn={isEnabled}
                        onPress={() => setIsEnabled(!isEnabled)}
                        circleColorOff='#FFF'
                        circleColorOn='#FFF'
                        backgroundColorOn='#EC6138'
                        backgroundColorOff='#E4E6EC'
                        containerStyle={{
                            width: 52, // 这里设置开关的宽度
                            height: 28, // 设置开关的高度
                            borderRadius: 20,
                            padding: 4,
                        }}
                        circleStyle={{
                            width: 22, // 设置开关按钮的宽度
                            height: 22, // 设置开关按钮的高度
                            borderRadius: 15,
                        }}
                    />
                </View>
            </View>
        </View>

    );
}

const styles = StyleSheet.create({
    settingWrap: {
        marginTop: 14,
        width: scaleSize(351),
        marginLeft: 12,
        backgroundColor: "#fff",
        borderRadius: 10,
        paddingLeft: 15,
        paddingRight: 15,
    },
    settingItem: {
        flexDirection: "row",
        height: 48,
        alignItems: "center",
        justifyContent: "space-between",
        borderBottomWidth: 0.5,
        borderBottomColor: "#E4E6EC"
    },
    cleanBom: {
        borderBottomWidth: 0
    },
    settingText: {
        fontSize: 14,
        color: "#2A2B30"
    },
    loginOut: {
        width: scaleSize(351),
        marginLeft: 12,
        height: 44,
        backgroundColor: "#fff",
        borderRadius: 10,
        marginTop: 80

    },
    loginOutText: {
        textAlign: "center",
        lineHeight: 44,
        fontSize: 14,
        color: "#333",
        fontWeight: "bold"
    },
});
